package com.yiyw.herostory.bo;

import io.netty.channel.Channel;
import io.netty.util.AttributeKey;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author yiyw
 * @Description TODO
 * @Date 2022/8/14 14:37
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserBo {
    public UserBo(Integer userId, String heroAvatar) {
        this.userId = userId;
        this.heroAvatar = heroAvatar;
    }

    /***
     * 玩家Id
     */
    private Integer userId;
    /***
     * 玩家类别
     */
    private String heroAvatar;

    private int hp = 100;

    // 起始位置 X
    private float moveFromPosX;
    // 起始位置 Y
    private float moveFromPosY;
    // 移动到位置 X
    private float moveToPosX;
    // 移动到位置 Y
    private float moveToPosY;
    // 启程时间戳
    private long moveStartTime;

    public int subUserHp(int subHp) {
        if (hp >= subHp) {
            hp = hp - subHp;
        }else {
            hp = 0;
        }
        return hp;
    }
}
